#!/bin/bash
# Program:
#  This program shows
# History:
# 2017-05-18 zmqc First release
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
emacsclient -e '(server-running-p)' &> /dev/null
if [ $? != 0 ]; then
    tmux send-keys -t emacsserver \
         '/usr/local/bin/emacs -f server-start -f ove-mode -nw' C-m
    sleep 1.5s
fi
if [ $# == 0 ]; then
    emacsclient -t
    exit
fi
filefile=`file $@`
filename=${filefile##*symbolic* }
if [ "$filename" == "$filefile" ]; then
    filename=$@
fi
emacsclient -t $filename
